const Mock = require("mockjs"); //引入mock
const menus = require("./menus.json");

const mockAuth = (data) => {
	return Mock.mock(Object.assign({
		"success": true,
		"status": 200,
		"message": "成功",
		"headers": {
			"authorization": "123456798"
		}
	}, data));
};

const mockCommon = (data) => {
	return Mock.mock(Object.assign({
		"success": true,
		"status": 200,
		"message": "成功"
	}, data));
};

const Datas = {
	"blank": mockCommon({"data": ""}),
	"/auth/login": mockAuth({
		"data": {
			"user": {"userName": "admin", "permission": 6},
			"menus": menus
		}
	}),
	"/rest": mockCommon({
		"data|1-9": [
			{
				"key|+1": 1,
				"mockTitle|1": ["肆无忌惮"],
				"mockContent|1": ["角色精湛主题略荒诞", "理由太短 是让人不安", "疑信参半 却无比期盼", "你的惯犯 圆满", "别让纠缠 显得 孤单"],
				"mockAction|1": ["下载", "试听", "喜欢"]
			}
		]
	})
};
module.exports = Datas;
